# config.py
from pydantic_settings import BaseSettings
from typing import Optional

class Settings(BaseSettings):
    # --- 数据库 ---
    SUPABASE_DB_URL: str  # 必填

    # --- 高德地图 ---
    GAODE_API_KEY: Optional[str] = None  # 可选

    # --- 表名配置 ---
    TABLE_NAME_CHARGING_STATIONS: str = "charging_stations"
    # 可以在这里添加其他表名，例如:
    # TABLE_NAME_USERS: str = "users"
    # TABLE_NAME_ORDERS: str = "orders"

    # --- 请求间隔 ---
    REQUEST_INTERVAL: float = 0.2  # 秒

    # --- 其他通用配置 ---
    APP_TITLE: str = "宁电热力图 - 后端服务"
    APP_DESCRIPTION: str = "提供南京充电桩数据接口"

    class Config:
        env_file = ".env"  # 指定环境变量文件
        env_file_encoding = 'utf-8'

# 创建全局配置实例
settings = Settings()